clearvars -except Globaloption

if exist('Globaloption', 'var') == 0
    Globaloption.savefig = 1;
end

[cy_ST] = xlsread('../../data/supplement/UK_cony.xlsx', 'UK basis (ST)', 'CK5:CK104');
cy_date = xlsread('../../data/supplement/UK_cony.xlsx', 'UK basis (ST)', 'A5:A104');

[cy_LT] = xlsread('../../data/supplement/UK_cony.xlsx', 'UK basis (LT)', 'CK5:CK104');

middate1 = 1914;
middate2 = 1931;
middate3 = 1951;
middate4 = 1925;

f = figure;
plot(cy_date, cy_ST, 'black', 'LineWidth', 1.5);
hold on
plot(cy_date, cy_LT, 'red--', 'LineWidth', 1.5);
plot(cy_date(1:find(cy_date == middate2)), nanmean(cy_ST(1:find(cy_date == middate2))) * ones(1, find(cy_date == middate2)), 'black')
plot(cy_date(find(cy_date == middate3):end), nanmean(cy_ST(find(cy_date == middate3):end)) * ones(1, 22), 'black')
grid on
ylabel('\% per year')
legend('Short Rate', 'Long Rate')
xlim([1873 1972]);
set(gcf, 'PaperUnits', 'inches', 'Units', 'inches');
f.PaperSize = [10 5];

if Globaloption.savefig == 1
    print('../../results/figures_main/UK/UK_cy', '-dpdf', '-fillpage')
end

% section 2.2 summary for Figure 3
nanmean(cy_LT(1:find(cy_date == middate1)))
nanmean(cy_ST(1:find(cy_date == middate1)))
nanmean(cy_LT(find(cy_date == middate4):find(cy_date == middate2)))
nanmean(cy_ST(find(cy_date == middate4):find(cy_date == middate2)))
nanmean(cy_LT(find(cy_date == middate4):find(cy_date == middate2)))
nanmean(cy_ST(find(cy_date == middate4):find(cy_date == middate2)))
nanmean(cy_LT(find(cy_date == middate3):end))
nanmean(cy_ST(find(cy_date == middate3):end))
